﻿#pragma once
#include<afxwin.h>

// CMyMenu
const int MAX_MENUCOUNT = 60, ITEMHEIGHT = 26, ITEMWIDTH = 120;

struct MenuItemInfo
{
	// 菜单项文本
	CString m_strItemText;
	// 菜单标记 -2顶层菜单,-1弹出式菜单,0分隔条,其他普通菜单
	int m_nItemID;
};

class CMyMenu : public CMenu
{
	DECLARE_DYNAMIC(CMyMenu)

public:
	CMyMenu();
	virtual ~CMyMenu();
	BOOL ChangeMenuItem(CMenu* pMenu,BOOL bTop = FALSE);
	BOOL AttachMenu(UINT nID);
	void DrawItemText(CDC* pDC,LPSTR str,CRect rect);
	void DrawTopMenu(CDC* pDC, CRect rect,BOOL bSelected = FALSE);
	void DrawSeparater(CDC* pDC, CRect rect);
	void DrawComMenu(CDC* pDC, CRect rect,COLORREF colorFrom, COLORREF colorTo,BOOL bSelected = FALSE);
	void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);

	MenuItemInfo m_ItemList[MAX_MENUCOUNT];

	int m_nIndex;
	int m_IconIndex;
};


